home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1995 #5 & #6
/
Amiga Plus CD - 1995 - No. 5 and 6.iso
/
pd
/
daten
/
astrolog
/
src
/
astdev.doc
< prev
next >
Wrap
Text File
|
1995-08-11
|
11KB
|
462 lines
TABLE OF CONTENTS
amiga/AmigaClearScreen
amiga/AmigaDisplayExit
amiga/AmigaDisplayInit
amiga/AmigaDisplayPaging
amiga/AmigaDisplayResize
amiga/AmigaDisplayUpdate
amiga/AmigaGetKey
rastport/rp_dispose
rastport/rp_new
xtras/xPrint
xtras/xPrintAt
xtras/xPutString
amiga/AmigaClearScreen amiga/AmigaClearScreen
NAME
AmigaClearScreen -- Clear Astrolog's Amiga graphics display
SYNOPSIS
AmigaClearScreen();
void AmigaClearScreen(void);
FUNCTION
This procedure unsets all pixels in the drawing page.
INPUTS
none
RESULT
none
EXAMPLE
NOTES
Calling this function is usually faster than painting a rectangle
covering the whole screen.
BUGS
SEE ALSO
AmigaDisplayPaging()
amiga/AmigaDisplayExit amiga/AmigaDisplayExit
NAME
AmigaDisplayExit -- Dispose Astrolog's Amiga graphics stuff
SYNOPSIS
AmigaDisplayExit();
void AmigaDisplayExit(void);
FUNCTION
This function closes Astrolog's window and screen which had been
provided via AmigaDisplayInit(). If paging is on, i.e. a 2nd
page has been provided for animations, then this page is disposed
as well.
INPUTS
none
RESULT
none
EXAMPLE
#include "astrolog.h"
/* ... */
if( AmigaDisplayInit() == 0 )
{
/* do some gfx... */
AmigaDisplayExit();
}
else error();
NOTES
BUGS
SEE ALSO
AmigaDisplayInit()
amiga/AmigaDisplayInit amiga/AmigaDisplayInit
NAME
AmigaDisplayInit -- Initialize an Amiga screen for Astrolog charts
SYNOPSIS
error= AmigaDisplayInit();
int AmigaDisplayInit(void);
FUNCTION
This function opens an Amiga screen with an EGA palette and a sizable
window which is large enough to hold `gs.xWin' pixel columns and
`gs.yWin' pixel rows. If this should fail for any reason, an error
code != 0 is returned.
INPUTS
none
RESULT
error - != 0 in case of an error, 0 otherwise
EXAMPLE
#include "astrolog.h"
/* ... */
if( AmigaDisplayInit() == 0 )
{
/* do some gfx... */
AmigaDisplayExit();
}
else error();
NOTES
Hack: The EGA colors provided for the screen are taken from the
global rgbbmp[] array (see xdata.c). However, if the `us.fAnsi' flag
is set, a slightly brighter palette is used.
Note also that this function sets `us.fAnsi' to `fFalse' to make sure
that no ANSI characters are used in the graphic chart mode. The
initial value of `us.fAnsi' is resored by AmigaDisplayExit().
BUGS
SEE ALSO
AmigaDisplayExit()
amiga/AmigaDisplayPaging amiga/AmigaDisplayPaging
NAME
AmigaDisplayPaging -- Allocate or free the page for animations
SYNOPSIS
paging= AmigaDisplayPaging();
int AmigaDisplayPaging(void);
FUNCTION
Here we allocate a 2nd rastport for double buffering. All Amiga
drawing happens in `gi.rp' and here we replace `gi.rp' with a newly
allocated rastport which has the same size as the one of the astrolog
screen `gi.scr'. Since paging is mainly used for animation purposes,
we also add the INTUITICKS bit to our window's IDCMP port.
Failure due to low memory is no fatal error because double buffering is
only a bonus for the animations.
INPUTS
none
RESULT
paging - 0 if we disabled paging with this call, !=0 otherwise.
EXAMPLE
#include "astrolog.h"
/* ... */
if( AmigaDisplayInit() == 0 )
{
/* switch to double buffering mode */
if(!gi.paging)
AmigaDisplayPaging();
/* do some anim stuff... */
AmigaDisplayExit();
}
else error();
NOTES
BUGS
SEE ALSO
AmigaDisplayPaging(), AmigaDisplayExit()
amiga/AmigaDisplayResize amiga/AmigaDisplayResize
NAME
AmigaDisplayResize -- Guarantee certain graphic display dimensions
SYNOPSIS
error= AmigaDisplayResize(width, height);
int AmigaDisplayResize(int, int);
FUNCTION
This function makes sure that the Amiga graphics page (screen and
window) are large enough to hold a graphic with `width' pixels
horizontally and `height' pixels vertically. If the current screen
is large enough, nothing happens. Otherwise it will be enlarged
to the given size.
INPUTS
none
RESULT
error - != 0 in case of an error, 0 otherwise
EXAMPLE
NOTES
BUGS
SEE ALSO
AmigaDisplayInit(), AmigaDisplayExit()
amiga/AmigaDisplayUpdate amiga/AmigaDisplayUpdate
NAME
AmigaDisplayUpdate -- Display the temporary drawing page
SYNOPSIS
AmigaDisplayUpdate();
void AmigaDisplayUpdate(void);
FUNCTION
If double buffering is enabled, then the hidden page (which is the
one we use to paint on) will be copied to the currently visible page.
Without any 2nd page, calling this procedure is a no-op.
INPUTS
none
RESULT
none
EXAMPLE
NOTES
BUGS
SEE ALSO
AmigaDisplayPaging()
amiga/AmigaGetKey amiga/AmigaGetKey
NAME
AmigaGetKey -- Wait for a keypress and return it's ASCII code
SYNOPSIS
key= AmigaGetKey();
int AmigaGetKey(void);
FUNCTION
Wait for a keypress and return the ASCII code of that key. This
function distinguishes between console mode and graphics mode and
calls getkey() if there is no graphics window.
INPUTS
none
RESULT
key - The ASCII code of the character on the pressed key
EXAMPLE
NOTES
BUGS
SEE ALSO
getkey()
rastport/rp_dispose rastport/rp_dispose
NAME
rp_dispose -- Free a RastPort allocated via rp_new()
SYNOPSIS
nil= rp_dispose(rp);
struct RastPort *rp_dispose(struct RastPort *);
FUNCTION
This function returns all memory allocated for the given RastPort,
the attached rp->BitMap and all bitplanes to the system free pool.
INPUTS
rp - A RastPort allocated vi rp_new()
RESULT
nil - if rp has been allocated via rp_new() then
(struct RastPort *)NULL will be returned,
rp (unchanged), otherwise.
EXAMPLE
NOTES
BUGS
SEE ALSO
rp_new()
rastport/rp_new rastport/rp_new
NAME
rp_new -- Allocate a RastPort including a BitMap and Bitplanes
SYNOPSIS
rp= rp_new(width, height, depth);
struct RastPort *rp_new(int, int, int);
FUNCTION
This function allocates a new RastPort and attaches a new BitMap to
it with initialized, empty bitplanes.
INPUTS
width -
height -
depth -
RESULT
rp - A new RastPort
EXAMPLE
NOTES
BUGS
SEE ALSO
rp_dispose()
xtras/xPrint xtras/xPrint
NAME
xPrint -- Render a format string to astrolog's graphic screen
SYNOPSIS
xPrint(fmt,...);
void xPrint(char *,...);
FUNCTION
This procedure does basically the same as xPutString(), i.e. it
renders a string to the graphic screen, using astrolog's internal
font. The difference between xPutString() and xPrint() is that
xPrint() performs printf() like substitutions in the given
format string `fmt'.
INPUTS
fmt - A printf() like format string and
... it's arguments
RESULT
none
EXAMPLE
NOTES
BUGS
SEE ALSO
xPutString(), xPrintAt()
xtras/xPrintAt xtras/xPrintAt
NAME
xPrintAt -- Render format string at given position on the screen
SYNOPSIS
xPrintAt(line,column, fmt,...);
void xPrintAt(int,int, char *,...);
FUNCTION
This procedure moves an invisible cursor to given location
(line,column) on astrolog's screen and renders the format string
`fmt' at this location via xPutString() after expanding it using
the given arguments `...' (if present).
INPUTS
line,column - The position where the first character shall be
rendered on the screen
fmt - A printf() like format string and
... it's arguments
RESULT
none
EXAMPLE
xPrintAt(5,3,"{green}I compute {white}1+1={red}%d{green}.",1+1);
NOTES
You should *always* use xPrintAt() before using either xPrint()
or xPutString() in order to initialize the cursor position.
BUGS
SEE ALSO
xPutString(), xPrint()
xtras/xPutString xtras/xPutString
NAME
xPutString -- Render text on the graphic screen
SYNOPSIS
xPutString(str);
void xPutString(char *);
FUNCTION
This procedure prints given string `str' onto astrolog's graphic chart
display at the position where the previous call's output ended. I.e.:
xPutString() has an invisible cursor which is advanced to the end of
it's output, each time you call this function. The usual "escaped"
character sequences (like '\n' ot '\b') are handled by this function
as well.
The text is rendered using the current pen as set via DrawColor().
However, some special macros can be used to change the color within
a string. These macros are:
{black} kBlack {dkgray} kDkGray
{maroon} kMaroon {red} kRed
{dkgreen} kDkGreen {green} kGreen
{orange} kOrange {yellow} kYellow
{dkblue} kDkBlue {blue} kBlue
{purple} kPurple {magenta} kMagenta
{dkcyan} kDkCyan {cyan} kCyan
{ltgray} kLtGray {white} kWhite
INPUTS
str - The string to render
RESULT
none
EXAMPLE
xPrintAt(3,5,""); /* initialize cursor position */
xPutSting("This text is rendered using the current color,\n"
"{white}whereas {red}this {green}changes {purple}it");
NOTES
xPutString() restores the initial pen if a color macro changes it.
So xPutString("{red}") is not the same as DrawColor(kRed).
BUGS
'\t' is not implemented.
SEE ALSO
xPrint(), xPrintAt()